package com.dc.adaptor.transport.addressconvertor;

import java.util.HashMap;

import com.dc.adaptor.transport.TransportMeta;

public class AddressConvertorFactory {

	public static HashMap<String, AddressConvertor<TransportMeta>> map = new HashMap<String,AddressConvertor<TransportMeta>>();
	public static String FTPPROTOCOL = "FTP";
	public static String MQPROTOCOL = "MQ";
	static{
		map.put(FTPPROTOCOL, new FTPAddressConvertor());
		map.put(MQPROTOCOL, new MQAddressConvertor());
		map.put("JMS", new MQAddressConvertor());
		map.put("WS2APP", new Ws2AppAddressConvertor());
		map.put("WSInput", new QueueAddressConvertor());
		map.put("WSTCISS", new WsTcissAddressConvertor());
		map.put("WS2BANKTAX", new Ws2BankTaxAddressConvertor());
	}
	
	public static void addAddressMeta(String protocolName, AddressConvertor<TransportMeta> am){
		map.put(protocolName, am);
	}
	
	public static AddressConvertor<TransportMeta> getAddressMeta(String protocolName){
		AddressConvertor<TransportMeta> am = (AddressConvertor<TransportMeta>)map.get(protocolName);
		if(am == null){
			throw new RuntimeException("Can not find the AddressMeta for the PortocolName : "+protocolName);
		}
		return am;
	}
}
